﻿using DocumentFormat.OpenXml.Lite.WordprocessingML.Word.Types;
using DocumentFormat.OpenXml.Lite.Xml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace DocumentFormat.OpenXml.Lite.WordprocessingML.Word.RunElements
{
    /// <summary>
    /// Absolute Position Tab Character
    /// </summary>
    [XmlRoot("ptab", Namespace = Constants.WordMain)]
    public class PositionTab : XmlSerializable, IRunSingleElement
    {
        [XmlAttribute("alignment", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public ST_PTabAlignment Alignment { get; set; }

        [XmlAttribute("relativeTo", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public ST_PTabRelativeTo RelativeTo { get; set; }

        [XmlAttribute("leader", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public ST_PTabLeader Leader { get; set; }

        public PositionTab() { }

        public void Copy(object obj)
        {
            if (obj is PositionTab)
            {
                this.Leader = (obj as PositionTab).Leader;
                this.Alignment = (obj as PositionTab).Alignment;
                this.RelativeTo = (obj as PositionTab).RelativeTo;
            }
        }
    }
}
